package Demo01_15;

import java.util.Random;
import java.util.Scanner;

/**
 * Created by 14229 on 2020/1/16.
 */
public class Test07 {
    public static void main(String[] args) {
        Random ra = new Random();
        int sum = 0;
        String s = "";
        Scanner sc = new Scanner(System.in);
        while (true) {
            System.out.println("1.发牌    2.结束发牌");
            int i = sc.nextInt();
            switch (i) {
                case 1:
                    int i1 = ra.nextInt(13) + 1;
                    s += i1+" ";
                    sum += i1;
                    if (sum<=21){
                        System.out.print("手上的牌有："+s);
                        System.out.println("累加的点数为："+sum);
                        break;
                    }else {
                        System.out.println("点数为："+sum+" 大于21结束游戏");
                        return;
                    }
                case 2:
                    System.out.println("您现在手上的牌有："+s+" 点数为："+sum);
                    return;
            }
        }
    }
}
